// V-backend/src/routes/orders.js
const express = require('express');
const router = express.Router();
const orderController = require('../controllers/orderController');
const { auth } = require('../middleware/auth');  // 修复这里

// 需要认证的路由
router.post('/', auth, orderController.createOrder);
router.get('/my-orders', auth, orderController.getUserOrders);
router.get('/:orderId', auth, orderController.getOrderById);
router.put('/:orderId/cancel', auth, orderController.cancelOrder);
router.post('/:orderId/pay', auth, orderController.processPayment);

module.exports = router;